/**
 * 论坛文章api设置
 */
import {spring} from "@/config";
import { mock } from "@/config";
const BASEURL:string = '/blog'
const BASEURL_ABOUT:string = '/articleAbout'
export function postSearchBlog(param:string|number) {
    return mock({
        url: BASEURL+'/searchBlog',
        method: 'POST',
        data: param
    })
}
// 创建文章
export function postBlogCreateArticle(param:{
    articleName: string,
    articleIntro: string,
    articleContent: string,
    articleCoverImgs: any | File
}
){
    return spring({
        url: BASEURL+'/createArticle',
        method: 'POST',
        data: param
    })
}
// 删除文章
export function postBlogDelArticle(param:{
    articleId:number
}){
    return spring({
        url: BASEURL+'/delArticle',
        method: 'POST',
        params: param
    })
}
//  更新文章
export function postBlogUpdateArticle(param:{
    Id:number,
    articleName: string,
    articleIntro: string,
    articleContent: string,
    articleCoverImgs: any | File
}){
    return spring({
        url: BASEURL+'/updateArticle',
        method: 'POST',
        data: param
    })
}
// 获取文章列表
export function postBlogGetArticle(param:{
    pageSize?: number,
    pageNum?: number,
    type: string
}){
    return spring({
        url: BASEURL+'/getArticle',
        method: 'POST',
        data: param
    })
}
// 搜索文章 -- 文章名称、简介、内容
export function postBlogQueryArticle(param:{
    articleName?: string,
    articleIntro?: string,
    articleContent?: string
}){
    return spring({
        url: BASEURL+'/queryArticle',
        method: 'POST',
        data: param
    })
}
// 通过id获取文章
export function postBlogGetArticleById(param:{
    articleId: number,
}){
    return spring({
        url: BASEURL+'/getArticleById',
        method: 'POST',
        params: param
    })
}
// 文章点赞
export function postBlogArticleLike(param:{
    articleId: number,
}){
    return spring({
        url: BASEURL_ABOUT+'/like',
        method: 'POST',
        params: param
    })
}
// 创建收藏夹
export function postBlogCreateCollection(param:{
    collectName: string,
    collectIntro: string
}){
    return spring({
        url: BASEURL_ABOUT+'/createCollect',
        method: 'POST',
        data: param
    })
}
// 删除收藏夹
export function postBlogDeleteCollection(param:{
    collectId: number
}){
    return spring({
        url: BASEURL_ABOUT+'/deleteCollect',
        method: 'POST',
        params: param
    })
}
// 收藏文章
export function postBlogCollectionArticle(param:{
    collectId: number,
    articleId: number
}){
    return spring({
        url: BASEURL_ABOUT+'/collectArticle',
        method: 'POST',
        data: param
    })
}
//  取消收藏文章
export function postBlogDeleteCollectArticle(param:{
    collectId: number,
    articleId: number
}){
    return spring({
        url: BASEURL_ABOUT+'/deleteCollectArticle',
        method: 'POST',
        data: param
    })
}
// 获取收藏夹列表
export function postBlogGetCollect(param:{
    pageSize?: number,
    pageNum?: number
}){
    return spring({
        url: BASEURL_ABOUT+'/getCollect',
        method: 'post',
        params: param
    })
}
//  获取收藏夹文章列表
export function postBlogGetCollectArticle(param:{
    pageSize?: number,
    pageNum?: number,
    collectId: number
}){
    return spring({
        url: BASEURL_ABOUT+'/getCollectArticle',
        method: 'post',
        params: param
    })
}
// 文章评论
export function postBlogAddReview(param:{
    pageSize?: number,
    pageNum?: number,
    articleId: number,
    reviewContent: string,
    parentReview: null
}){
    return spring({
        url: BASEURL_ABOUT+'/addReview',
        method: 'post',
        data: param
    })
}
// 回复评论
export function postBlogReviewComment(param:{
    articleId: number,
    reviewContent: string,
    parentReview: number
}){
    return spring({
        url: BASEURL_ABOUT+'/reviewComment',
        method: 'post',
        data: param
    })
}
//  获取评论列表
export function postBlogGetReview(param:{
    pageSize?: number,
    pageNum?: number,
    articleId: number
}){
    return spring({
        url: BASEURL_ABOUT+'/getReview',
        method: 'post',
        params: param
    })
}
// 评论点赞
export function postBlogLikeReview(param:{
    reviewId: number
}){
    return spring({
        url: BASEURL_ABOUT+'/likeReview',
        method: 'post',
        data: param
    })
}
// 踩评论
export function postBlogDislikeReview(param:{
    reviewId: number
}){
    return spring({
        url: BASEURL_ABOUT+'/dislikeReview',
        method: 'post',
        data: param
    })
}
// 举报评论
export function postBlogReportReview(param:{
    reviewId: number
}){
    return spring({
        url: BASEURL_ABOUT+'/reportReview',
        method: 'post',
        data: param
    })
}
